import Vue from 'vue'
import App from './App.vue'

// 导入路由对应组件
// import Find from '@/views/Find' // vue文件中，@表示 src目录的绝对路径
// import My from '@/views/My'
// import Part from '@/views/Part'
import Index from './views/Index.vue'

import Fenlei from './views/Fenlei.vue'
import NotFound from './views/NotFound.vue'
import Dingdan from './views/Dingdan.vue'
import My from './views/My.vue'
Vue.config.productionTip = false
// 导入
import VueRouter from 'vue-router'
// 使用路由插件
Vue.use(VueRouter)
//创建路由规则数组
const routes =[
	{
		path:'/',
		//!重定向
		redirect: '/index'
	},
	{
		path:'/index',
		component:Index
	},
	{
		path:'/fenlei',
		component:Fenlei
	},
{
path:'/dingdan',
component:Dingdan
},
{
path:'/my',
component:My
},
	{
		path:'*',
		component:NotFound
	}
]
//创建路由对象,传入规则
const router=new VueRouter({
	routes,
	mode:'history'
})
//关联Vue实例
new Vue({
	router,
	render: (h) => h(App),
}).$mount('#app')
//步骤
//1.下包 yarn add vue-router@3 配合vue2使用
//2.引入
//3.注册 Vue.use()
//4.配置路由规则
//5.创建路由对象 new VueRouter()
//6.路由引入到vue实例上
//7.挂载点  router-view
